<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
    <body>
        <ui:composition template="../templates/default3.xhtml">        
            <ui:define name="content">
                <h:form id="searchJob" binding="#{jobManagerBean.loadSearchJob}">
                    <p:panel header="Select job" id="selectjob">
                        <p:dataTable id="job" var="job" value="#{jobManagerBean.jobs}" selectionMode="single" 
                                     selection="#{jobManagerBean.job}" update="updateLead"  paginator="true" rows="10"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" >
                            <p:column headerText="Job ID">  
                                <h:outputText value="#{job.jobId}" />  
                            </p:column> 
                            <p:column headerText="Job Date" >  
                                <h:outputText value="#{job.jobDate}" >
                                    <f:convertDateTime pattern="dd-MM-yyyy hh:mm a" timeZone="#{defaultManagerBean.tz}"/>
                                </h:outputText> 
                            </p:column> 
                            <p:column headerText="Job Type" >  
                                <h:outputText value="#{job.type}"> 
                                </h:outputText>  
                            </p:column> 
                            <p:column filterBy="#{job.customer.company}" headerText="Company" filterMatchMode="contains">  
                                <h:outputText value="#{job.customer.company}" />  
                            </p:column>
                            <p:column  headerText="Description">  
                                <h:outputText value="#{job.description}" />  
                            </p:column> 

                        </p:dataTable>
                                            <table class="table-submit">
                        <tr>
                            <td align="center">
                                <p:commandButton value="Select Job" actionListener="#{jobManagerBean.edit}" ajax="true"/>
                            </td>
                        </tr>
                    </table>

                    </p:panel>


                    <p:panel header="Sales Orders Status" id="selectjob2">
                        <p:dataTable id="salesOrders" var="salesOrder" value="#{jobManagerBean.salesOrders}" >
                            <p:column headerText="S/O ID">  
                                <h:outputText value="#{salesOrder.id}" />  
                            </p:column> 
                            <p:column headerText="S/O Date">  
                                <h:outputText value="#{salesOrder.creationDate}" >
                                    <f:convertDateTime pattern="dd-MM-yyyy hh:mm a" timeZone="#{defaultManagerBean.tz}"/>
                                </h:outputText> 
                            </p:column>
                            <p:column filterBy="#{salesOrder.status}" headerText="S/O Status" filterMatchMode="contains">  
                                <h:outputText value="#{salesOrder.status}" />  
                            </p:column> 
                            <p:column headerText="Job ID">  
                                <h:outputText value="#{salesOrder.job.jobId}" />  
                            </p:column> 
                            <p:column filterBy="#{salesOrder.job.type}" headerText="Job Type" filterMatchMode="contains">  
                                <h:outputText value="#{salesOrder.job.type}"> 
                                </h:outputText>  
                            </p:column> 
                            <p:column filterBy="#{salesOrder.job.customer.company}" headerText="Company" filterMatchMode="contains">  
                                <h:outputText value="#{salesOrder.job.customer.company}" />  
                            </p:column> 
                            <p:column headerText="Job Description">  
                                <h:outputText value="#{salesOrder.job.description}" />  
                            </p:column> 
                        </p:dataTable>

                    </p:panel>
                    
                    <p:panel header="Delivery date confirmation" id="selectjob3" rendered="#{jobManagerBean.haveConfirm}" >
                        
                        <p:dataTable id="waitingSalesOrders" var="salesOrder" value="#{jobManagerBean.salesOrdersWaiting}" 
                                selectionMode ="single" selection="#{jobManagerBean.salesOrder}" >
                            <p:column headerText="S/O ID">  
                                <h:outputText value="#{salesOrder.id}" />  
                            </p:column> 
                            <p:column headerText="S/O Date">  
                                <h:outputText value="#{salesOrder.creationDate}" >
                                    <f:convertDateTime pattern="dd-MM-yyyy hh:mm a" timeZone="#{defaultManagerBean.tz}"/>
                                </h:outputText> 
                            </p:column>
                            <p:column filterBy="#{salesOrder.status}" headerText="S/O Status" filterMatchMode="contains">  
                                <h:outputText value="#{salesOrder.status}" />  
                            </p:column> 
                            <p:column headerText="Job ID">  
                                <h:outputText value="#{salesOrder.job.jobId}" />  
                            </p:column> 
                            <p:column filterBy="#{salesOrder.job.type}" headerText="Job Type" filterMatchMode="contains">  
                                <h:outputText value="#{salesOrder.job.type}"> 
                                </h:outputText>  
                            </p:column> 
                            <p:column filterBy="#{salesOrder.job.customer.company}" headerText="Company" filterMatchMode="contains">  
                                <h:outputText value="#{salesOrder.job.customer.company}" />  
                            </p:column> 
                            <p:column headerText="Job Description">  
                                <h:outputText value="#{salesOrder.job.description}" />  
                            </p:column> 
                        </p:dataTable>

                        <p:commandButton value="Resolve" actionListener="#{jobManagerBean.resolve}" ajax="true"/>
                    </p:panel>
                        
                        
             





                </h:form>
            </ui:define>        
        </ui:composition>
    </body>
</html>
